const App = {
    data() {
        return {
            tableData:[],
            agricultural_machinery:{}
        }
    },
    beforeCreate() {
        function setRem() {
            const designWidth = 750; // 设计稿宽度（rpx）
            const maxWidth = 540; // 可选：限制最大宽度（如手机端常见值）
            const screenWidth = Math.min(window.innerWidth, maxWidth);
            const scale = screenWidth / designWidth;
            document.documentElement.style.fontSize = scale + 'px';
        }
        setRem();//1rem = 0.5px 对标小程序在 375px 宽的屏幕上，1rpx = 0.5px（因为 750rpx / 375px = 2）
        window.addEventListener('resize', setRem);
    },
    mounted() {
        let ls_URL = window.location.href;
        let Agricultural_Machinery_SerialNumber = getQueryObject(ls_URL, "Agricultural_Machinery_SerialNumber");// 获取 nodeKey 参数
        this.getData(Agricultural_Machinery_SerialNumber);
    },
    methods: {
        getData(Agricultural_Machinery_SerialNumber){
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableNameWithOriginal`,
                method: "post",
                data: {
                    Data: 'agricultural_machinery',
                    Condition: "Agricultural_Machinery_SerialNumber='" + Agricultural_Machinery_SerialNumber + "'"
                },
                success: (res) => {
                    this.agricultural_machinery = res[0]
                    let lJSONObject_DataSet = {
                        Add:{
                            agricultural_machinery_browse:[{
                                Agricultural_Machinery_SerialNumber,
                                Open_ID:'oxS4B7tyTRYszs_PFjslwTGAV6yE'
                            }]
                        }
                    }
                    $.ajax({
                        headers: requestHeaders("JSON"),
                        url: `${mh}/generalBusiness/generalSaveByRequestBody`,
                        method: "post",
                        data: JSON.stringify({
                            Data: lJSONObject_DataSet,
                        }),
                        success: (res) => {
                           
                        },
                        complete: (XMLHttpRequest) => {
                            this.loading = false;
                            requestPretreatment(XMLHttpRequest)
                        }
                    });
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest)
                },
            })
        },
        
    },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");
